/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifndef _LINUXPEGMISCDEV_HPP_
#define _LINUXPEGMISCDEV_HPP_

typedef struct
{
    PEGINT    XMax;
    PEGINT    XMin;
    PEGINT    YMax;
    PEGINT    YMin;
    PEGBOOL   XReversed;
    PEGBOOL   YReversed;
    PEGINT    ScreenWidth;
    PEGINT    ScreenHeight;
    PEGBOOL   IsCalibrated;
    PEGBOOL   CurTouched;
    PEGBOOL   PrevTouched;
    PEGBOOL   CurTouched2;
    PEGBOOL   PrevTouched2;
    PegPoint  CurPos;
    PegPoint  PrevPos;
    PegPoint  CurPos2;
    PegPoint  PrevPos2;
    PEGBOOL   KeyChanged;
    PEGINT    KeyValue;
    PEGINT    KeyCode;
    PEGINT    RepeatCount;
    PEGINT    RepeatKey;
    PEGINT    RepeatDebounce;
} PEG_MISC_STATE;

#if defined(PEG_MISC_SUPPORT) && defined(PEG_MISC_INCLUDE)
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
class LinuxPegMiscDevice : public PegInputDevice
{
    public:
        LinuxPegMiscDevice(void);
        ~LinuxPegMiscDevice() {}
        void Run(void) {;}
        PEGBOOL Poll(int devNum);
        PEGBOOL SetMinMax(int newXMin, int newXMax, int newYMin, int newYMax, int screenWidth, int screenHeight);
        void UnCalibrate();

    protected:
        PEGBOOL ReadEventDevice(int devNum);
        PEGINT  GetScaledXPos(PEGINT RawVal);
        PEGINT  GetScaledYPos(PEGINT RawVal);
        void    CheckSendMessage(int devNum);
        PEG_MISC_STATE mState;
};
#endif
#endif // _LINUXPEGMISCDEV_HPP_


